const errorData = { value: 'error', label: '-' }

export const relationList = [
  { id: '1', label: '同时', value: 'AND', text: '同时' },
  { id: '2', label: '或', value: 'OR', text: '或' },
  { id: '3', label: '非', value: 'NOT', text: '非' }
]

export const getRelation = (key, data) => {
  const relation = relationList.find(item => item.value === key)
  return relation || errorData
}

export const operatorOptions = [
  { value: '>', label: '大于', text: '大于' },
  { value: '<', label: '小于', text: '小于' },
  { value: '==', label: '等于', text: '等于' },
  { value: '>=', label: '大于等于', text: '大于等于' },
  { value: '<=', label: '小于等于', text: '小于等于' }
]

export const getOperator = (key, data) => {
  const operator = operatorOptions.find(item => item.value === key)
  return operator || errorData
}
